/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __ASSETS_WIDGET_H__
#define __ASSETS_WIDGET_H__

#include <QtGui/QWidget>
#include <QtGui/QToolBar>
#include <QtGui/QTreeWidget>
#include <QtGui/QMenu>
#include <QtGui/QFileSystemModel>
#include <QtGui/QTreeView>

#include "ArchiveDialog.h"

namespace PQBuilder
{
	class AssetsTree : 
		public QTreeWidget
	{
		Q_OBJECT
	public:
		AssetsTree(QWidget *parent = 0);
		void loadArchives();//
	public slots:
		void addArchive(QString archiveName);
		void createArchive();
		void importArchive();
		void addFile();//add file to 
	protected:
		void mousePressEvent(QMouseEvent *evt);
		void mouseMoveEvent(QMouseEvent *evt);
		void contextMenuEvent(QContextMenuEvent *evt);

		void dragEnterEvent(QDragEnterEvent *evt);
		void dropEvent(QDropEvent *evt);
		void dragLeaveEvent(QDragLeaveEvent *evt);
		void dragMoveEvent(QDragMoveEvent *evt);

	private:
		void init();
		
		/*Map item to path string
		*/
		QString getItemPath(QTreeWidgetItem* item);
		void loadDirectories();
	private:
		QPoint _dragStartPosition;
		ArchiveDialog* _dialog;
	};
	
	class ResourceBrowser : 
		public QWidget
	{
		Q_OBJECT
	public:
		ResourceBrowser(QWidget *parent = 0);
		~ResourceBrowser();
	private:
		AssetsTree *_treeWidget;

		QTreeView* _view;
		QFileSystemModel * _model;


	};
}

#endif
